<?php
// $Id: HiddenInput.php 27 2010-11-16 12:49:54Z mjohnson60@gmail.com $


/**
 * Enter description here ...
 * 
 * @author Mark Phillip Johnson
 * @version 1.0
 * @copyright Copyright (c) 2010, markjohnson
 * @license http://www.gnu.org/licenses/gpl.html The GNU General Public License v3.0
 *
 */
class HiddenInput extends FormElement
{

	/**
	 * Enter description here ...
	 * @param string $name
	 * @param string $value
	 * @param string $id
	 * @param FormElement $parent
	 * @param array $attributes
	 */
	function __construct($name, $value, $id = NULL, $parent = NULL, $attributes = array())
	{
		$this->type = 'hidden';
		
		if (is_array($value))
		{
			parent::__construct($value, $name);
		}
		else
		{
			parent::__construct(NULL, $name, $value, $id, $parent, $attributes);
		}
	}

	/* 
	 * @see FormElement::_compile()
	 */
	public function _compile()
	{
		return $this->render();
	}

	/* 
	 * @see FormElement::render()
	 */
	public function render()
	{
		return '<input type="hidden" name="' . $this->name . '" id="' . $this->id . '" value="' . check_plain($this->value) . '"' . (empty($this->attributes) ? '' : attributes($this->attributes)) . " />\n";
	}
}